<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<div class="container">
		
	<div class="couponDiv">
		<ul class="nav nav-tabs pointnav">
			<li class="active"><a href="#tab1" data-toggle="tab"><img src="./image/title_img14.jpg"></a></li>
			<li><a href="#tab2" data-toggle="tab"><img src="./image/title_img15.jpg"></a></li>
			<li><a href="#tab3" data-toggle="tab"><img src="./image/title_img16.jpg"></a>
			<li>회원님의 포인트 점수는 ${point}점 입니다.<button type="button" id="pointDetail" class="btn btn-info btn-sm">포인트 내역</button></li>
		</ul>
		
		<div class="tab-content" style="height: 700px">
			<div class="tab-pane active" id="tab1" style="height: 700px">
				<c:forEach var="aCouList" items="${aCouList}" varStatus="status">
					<div class="couponBox">
						<table border="1" style="width: 300px; height: 130px">
							<tr>
								<td rowspan="2" style="width: 120px" align="center"><img src="${pageContext.request.contextPath}/upload/coupon/${aCouList.image}" width="115px" height="115px"></td>
								<td colspan="2" align="center" style="font-size: large;">${aCouList.cou_name}</td>
							</tr>
							<tr>
								<td align="center">${aCouList.count}개 남음</td>
								<td align="center">개당 ${aCouList.use_point}P</td>
							</tr>
						</table>
						<div class="total_btn">
							<input type="button" value="구매하기">
							<div class="total_menu">
							<form action="buyCoupon.do" method="get" name="buyCoupon">
								<fieldset>
									${aCouList.cou_name}<br>
									구매 하시겠습니까?<br>
									<input type="hidden" name="cou_id" value="${aCouList.cou_id}">
									<select name="count" class="school">
										<option value="수량" selected>수량</option>
										<option value="1">1</option>
										<option value="2">2</option>
										<option value="3">3</option>
										<option value="4">4</option>
										<option value="5">5</option>
									</select>
									<input type="submit" value="구입"><br>
								</fieldset>
							</form>
								<div class="total_close">
									<a href="#">닫기</a>
								</div>
							</div>
						</div>
					</div>
				</c:forEach>

			</div>

			<div class="tab-pane" id="tab2">
				<c:forEach var="buyCouList" items="${buyCouList}">
				    <div class="couponBox" id="${buyCouList.cou_id}">
						<table border="1" style="width: 300px; height: 130px">
							<tr>
								<td rowspan="2" style="width: 120px" align="center"><img src="${pageContext.request.contextPath}/upload/coupon/${buyCouList.image}" width="115px" height="115px"></td>
								<td colspan="2" align="center" style="font-size: large;">${buyCouList.cou_name}</td>
							</tr>
							<tr>
								<td align="center">${buyCouList.count}개 남음</td>
								<td align="center">구매일 : ${buyCouList.reg_date}</td>
							</tr>
						</table>
						<div align="right" id="${buyCouList.cou_id}">
							<c:if test="${buyCouList.show == 'Y'}">
								<input type="button" class="giftCoupon" value="선물하기">
							</c:if>
							<c:if test="${buyCouList.show == 'N'}">
								사용정지된 쿠폰입니다. 문의하세요
							</c:if>
						</div>
					</div>
				</c:forEach>
			</div>
			
			<div class="tab-pane" id="tab3">
				<c:forEach var="giftCouList" items="${giftCouList}">
				    <div class="couponBox" id="${giftCouList.cou_id}">
						<table border="1" style="width: 300px; height: 130px">
							<tr>
								<td rowspan="2" style="width: 120px" align="center"><img src="${pageContext.request.contextPath}/upload/coupon/${giftCouList.image}" width="115px" height="115px"></td>
								<td colspan="2" align="center" style="font-size: large;">${giftCouList.cou_name}</td>
							</tr>
							<tr>
								<td align="center">${giftCouList.count}개 남음</td>
								<td align="center">받은날 : ${giftCouList.reg_date}</td>
							</tr>
						</table>
						<div align="left">선물 보낸이 ID : <a href="listDetail.do?detail_id=${giftCouList.senderid}">${giftCouList.senderid}</a></div>
						<div align="right" style="margin-top: -19px">
							<c:if test="${giftCouList.show == 'Y'}">
								<form action="useCoupon.do" method="post">
									<input type="hidden" name="senderid" value="${giftCouList.senderid}">
									<input type="hidden" name="cou_id" value="${giftCouList.cou_id}">
									<input type="submit" class="useCoupon" value="사용하기"><br><br>
								</form>
							</c:if>
							<c:if test="${giftCouList.show == 'N'}">
								사용정지된 쿠폰입니다. 문의하세요
							</c:if>
						</div>
					</div>
				</c:forEach>
			</div>
		</div>
	</div>
</div>